﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace Registered_Student_Management
{
    public partial class F_ListStudentOfClass : Form
    {
        string connection_string = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=Database.mdb;Jet OLEDB:Database Password=51002201";
        public F_ListStudentOfClass()
        {
            InitializeComponent();
        }

        public int id;
        public int truyendata(string a)
        {
            id = int.Parse(a.ToString());
            return id;
        }

        private void F_ListStudentOfClass_Load(object sender, EventArgs e)
        {
            GB_ListStuOfClass.Visible = true;
            load_dgv_danhsachHVLop(sender , e);
        }

        private void load_dgv_danhsachHVLop(object sender, EventArgs e)
        {
            try
            {
                
                OleDbConnection cn = new OleDbConnection();
                cn.ConnectionString = connection_string;
                OleDbCommand command = new OleDbCommand();
                command.Connection = cn;
                command.CommandText = "select * from job where id_class = " + id;
                OleDbDataAdapter adapt = new OleDbDataAdapter(command);
                DataTable dt = new DataTable();
                adapt.Fill(dt);
                DGV_danhsachHVLop.DataSource = dt;
                cn.Close();
                cn.Dispose();
                cn = null;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
    }
}
